package cc.md888.app.web.cors;

import com.google.common.collect.Lists;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.CorsConfigurationSource;

import javax.servlet.http.HttpServletRequest;

public class IgnoreCorsConfigurationSource implements CorsConfigurationSource {
    @Override
    public CorsConfiguration getCorsConfiguration(HttpServletRequest request) {
        CorsConfiguration configuration = new CorsConfiguration();
        configuration.setAllowCredentials(false);
        configuration.setAllowedHeaders(Lists.newArrayList(CorsConfiguration.ALL));
        configuration.setAllowedMethods(Lists.newArrayList(CorsConfiguration.ALL));
        configuration.setAllowedOrigins(Lists.newArrayList(CorsConfiguration.ALL));
        return configuration;
    }
}
